import tkinter as tk
from tkinter import messagebox
import subprocess

def function1():
    subprocess.run(['python', 'extract.py'], check=True)

def function2():
    subprocess.run(['python', 'stj.py'], check=True)

def function3():
    subprocess.run(['python', 'rendering.py'], check=True)

def function4():
    print("功能4: 将汉化后的内容[output\\zh_cn.json]写回任务文件中")

def function5():
    print("功能5: 将任务文件覆盖回游戏中")

def exit_program():
    if messagebox.askokcancel("退出", "确定要退出程序吗？"):
        root.destroy()

# 创建主窗口
root = tk.Tk()
root.title("任务处理程序")

# 创建按钮并添加到主窗口
button1 = tk.Button(root, text="-1-将任务本地化语言文件内容写回任务,并拿到任务文件[input]中", command=function1)
button1.pack(pady=10)

button2 = tk.Button(root, text="-2-抽取任务内容至[output\en_us.json]中(不可重复抽取)", command=function2)
button2.pack(pady=10)

button3 = tk.Button(root, text="-3-汉化语言文件[output\en_us.json],还好完成后[output\zh_cn.json]", command=function3)
button3.pack(pady=10)

button4 = tk.Button(root, text="功能4", command=function4)
button4.pack(pady=10)

button5 = tk.Button(root, text="功能5", command=function5)
button5.pack(pady=10)

# 创建退出按钮
exit_button = tk.Button(root, text="退出", command=exit_program)
exit_button.pack(pady=10)


# 启动GUI程序
root.mainloop()